package com.msh.artascope.devcloud.client.qo;

import com.msh.artascope.interfaces.ILoginAccount;
import com.msh.frame.client.base.BaseProperties;
import com.msh.frame.client.base.BaseQo;
import com.msh.frame.client.validation.IList;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Collection;
import java.util.Date;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.Accessors;

/**
 * @author shihu
 * @email m-sh@qq.com
 */
@Data
@Accessors(chain = true)
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Schema(title = "域名配置Qo")
public class DomainConfigQo extends BaseQo<DomainConfigQo> {
  /**
   * 主键id
   */
  @Schema(title = "主键id")
  private Long id;

  /**
   * 域名
   */
  @Schema(title = "域名")
  private String domain;

  /**
   * http协议
   */
  @Schema(title = "http协议")
  private Integer httpFlag;

  /**
   * https协议
   */
  @Schema(title = "https协议")
  private Integer httpsFlag;

  /**
   * 证书
   */
  @Schema(title = "证书")
  private String tslCert;

  /**
   * 环境
   */
  @Schema(title = "环境")
  private Long envId;

  /**
   * 环境
   */
  @Schema(title = "环境集合in查询")
  private Collection<Long> envIdIn;

  /**
   * 租户id
   */
  @Schema(title = "租户id")
  private Long tenantId;

  /**
   * 创建时间
   */
  @Schema(title = "创建时间")
  private Date createTime;

  /**
   * 更新时间
   */
  @Schema(title = "更新时间")
  private Date updateTime;

  /**
   * 当前页数
   */
  @Min(groups = {IList.class}, value = 1, message = "currentPage从1开始")
  @Schema(title = "当前页数")
  protected Integer currentPage = 1;

  /**
   * 每页返回数量
   */
  @Min(groups = {IList.class}, value = 1, message = "pageSize最少返回1条")
  @Max(groups = {IList.class}, value = 10000, message = "pageSize最多返回10000条")
  @Schema(title = "每页返回数量")
  protected Integer pageSize = BaseProperties.MAX_PAGE_SIZE;

  public void initLoginAccount(ILoginAccount loginAccount) {
    this.tenantId = loginAccount.getTenantId();
  }


}